<?php /*a:1:{s:75:"/Users/zhufeng/source/365uxuan/xd-backend/application/admin/view/login.html";i:1540277475;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <title>后台登录</title>
    <link href="/static/admin/css/bootstrap.min.css" rel="stylesheet">
    <link href="/static/admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/static/admin/css/animate.min.css" rel="stylesheet">
    <link href="/static/admin/css/style.min.css" rel="stylesheet">
    <link href="/static/admin/css/login.min.css" rel="stylesheet">
    <!--极验验证需要引入的两个JS-->
    <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
    <script src="http://static.geetest.com/static/tools/gt.js"></script>

    <script>
        if(window.top!==window.self){window.top.location=window.location};
    </script>
</head>

<body class="signin">
<div class="signinpanel">
    <div class="row">
        <div class="col-sm-7" style="color:#fff">
            <div class="signin-info">
                <div class="logopanel m-b">
                </div>
                <div class="m-b"></div>
                <h4>欢迎使用XXXX <strong>后台管理</strong></h4>
                <ul class="m-b">

                </ul>
            </div>
        </div>
        <div class="col-sm-5" style="color:#fff">
            <form id="doLogin" name="doLogin" method="post" action="<?php echo url('doLogin'); ?>">
                <p class="m-t-md" id="err_msg">登录到后台</p>
                <input type="hidden" class="form-control pword m-b" id="loginKey" name="loginKey" />
                <input type="text" class="form-control uname" placeholder="用户名" id="username" name="username"/>
                <input type="password" class="form-control pword" placeholder="密码" id="password" name="password" />
                <input type="text" autocomplete="off" class="form-control uname" placeholder="验证码" id="code" name="code" />

                <img id="checkCode" style="width: 100%;margin-top: 15px;" src="<?php echo captcha_src(); ?>" />

                <button id="formSubmit" type="submit" class="btn btn-primary btn-block">登　录</button>
            </form>
        </div>
    </div>
    <div class="signup-footer">
        <div class="pull-left" style="color:#fff">
            &copy; 2017 All Rights Reserved.
        </div>
    </div>
</div>
<script src="/static/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="/static/admin/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/static/admin/js/jquery.form.js"></script>
<script src="/static/admin/js/layer/layer.js"></script>
<script src="/static/admin/js/common.js"></script>
<script src="/static/admin/js/plugins/validate/jquery.validate.min.js"></script>
<script src="/static/admin/js/plugins/validate/messages_zh.min.js"></script>
<script>

//以下为官方示例
$().ready(function () {

    // validate signup form on keyup and submit
    var icon = "<i class='fa fa-times-circle'></i> ";
    $("#doLogin").validate({
        rules: {
            username: {
                required: true,
            },
            password: {
                required: true,
            },
            code: {
                required: true,
            },
        },
        messages: {
            username: {
                required: "请输入用户名"
            },
            password: "请输入密码",
            code: "请输入验证码"
        },
        focusCleanup:true,
        submitHandler:function(form){

            $(form).ajaxSubmit({
                type: 'post',
                url: "<?php echo url('doLogin'); ?>",
                beforeSend:function() {
                    // 显示loading
                    index2 = layer.load(0, {
                        shade: [0.3,'#fff']
                    });
                },
                success: function(data){

                    if (data['code'] != 1) {
                        layer.msg(data.msg,{icon:2,time:1000,shade: 0.1,}, function(index){
                            layer.close(index)
                        });
                        $("#checkCode").attr("src", "<?php echo captcha_src(); ?>?t=<?php echo time(); ?>");
                        return false;
                    }

                    layer.msg(data.msg,{icon:1,time:1000,shade: 0.1,}, function(index){
                        window.location.href="<?php echo url('index/index'); ?>"
                    });
                },
                error: function(XmlHttpRequest, textStatus, errorThrown){
                    layer.msg('error!',{icon:1,time:1000});
                },
                complete:function() {
                    // 隐藏loading
                    layer.close(index2);
                }
            });
        }
    });
});

$(function(){

    $("#checkCode").click(function() {
        $(this).attr("src", "<?php echo captcha_src(); ?>?t=<?php echo time(); ?>");
    });

});

</script>
</body>
</html>